import React, { Component } from 'react'
import styles from "../assets/styles/tabA.module.css"

export default class TabA extends Component {
  state = {
    count: 10,
    msg: "xiaowang"
  }
  changeCount = (event, val) => {
    //异步代码。
    // this.setState({
    //   count: val
    // })
    // this.setState({
    //   count: 1000
    // })
    // this.setState({
    //   msg:"小五"
    // })

    this.setState({
      count:val,
      msg:"xiaowang"
    })
  }

  render() {
    console.log("render");
    const { count,msg } = this.state
    return (
      <div>
        <h3>TabA</h3>
        <p>state中msg：{msg}</p>
        <p>state的数据:{count}</p>
        <button onClick={(event) => this.changeCount(event, 123)}>点击触发</button>
      </div>
    )
  }
}
